package com.butterfly.hotkey.core.model;

import java.util.concurrent.atomic.LongAdder;

/**
 * @author butterfly
 * @since 2024/10/19
 */
public class HotKeyModel {

    /**
     * 来自于哪个应用
     */
    private String appName;

    /**
     * 创建的时间
     */
    private long createTime;
    /**
     * key的名字
     */
    private String key;

    /**
     * 该key出现的数量，如果一次一发那就是1，累积多次发那就是count
     * 使用 LongAdder 解决 多线程计数不准确的问题
     */
    private LongAdder count;

    /**
     * 是否是删除事件
     */
    private boolean remove;

    /**
     * 添加value
     *
     * @param value value
     */
    public void addCount(long value) {
        this.count.add(value);
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public LongAdder getCount() {
        return count;
    }

    public void setCount(LongAdder count) {
        this.count = count;
    }

    public boolean isRemove() {
        return remove;
    }

    public void setRemove(boolean remove) {
        this.remove = remove;
    }
}
